package com.ja.inquiry.mapper;

import com.ja.inquiry.pojo.*;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by 11936 on 2019/4/28.
 */

@Mapper
public interface InquiryMapper {
    Integer queryCount(InquirySelectVo inquirySelectVo);

    List<InquirySelectVo> queryPageBean(InquirySelectVo inquirySelectVo);

    @Select("select legalPersonCode from legalperson where id=#{legalPersonId}")
    String queryLegalPersonCode(Integer legalPersonId);

    @Insert("insert into inquiry(requestForQuotationId,createTime,startTime,endTime,creatorName," +
            "type,currencyCode,isTax,inquiryStatus,legalPersonId,legalPersonCode) values(" +
            "#{requestForQuotationId},#{createTime},#{startTime},#{endTime},#{creatorName}" +
            ",#{type},#{currencyCode},#{isTax},#{inquiryStatus},#{legalPersonId},#{legalPersonCode})")
    void addInquiry(CreateInquiry createInquiry);

    void addSpareDetailList(List<SpareDetail> spareDetailList);

    void addSupplierDetailList(List<SupplierDetail> supplierDetailList);

    Integer querySpareCount(SpareSelectVo spareSelectVo);
    List<String> querySupplierExistence(List<SupplierDetail> supplierDetails);
    List<Spare> selectMaterial(SpareSelectVo spareSelectVo);
    @Select("select spareCoding from sparedetail")
    List<SpareDetail> queryAllSpareDetail();
    //验证备件是否存在生产它的供应商（如果没有可生产它的供应商，提示出来生产它的都有谁）
    //供应商是否存在它可以生产的备件（如果没有它可生产的备件，提示出来它可以生产都有谁）
    List<RelationVo> querySpareAll(List<SpareDetail> spareDetails);
    List<RelationVo> querySupplierAll(List<SupplierDetail> supplierDetails);
    List<String> querySpareExistence(List<SpareDetail> spareDetails);
}
